package com.xixi.canal.client.util;


import java.lang.annotation.Annotation;

public abstract class Assert {

    public static void notNull( Object object, String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notInterface( Class<?> type, String message) {
        notNull(type, "Type must be not null");
        if (!type.isInterface()) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void withAnnotation(Class<?> type, Class<? extends Annotation> annotation, String message) {
        notNull(type, "Type must be not null");
        if (!type.isAnnotationPresent(annotation)) {
            throw new IllegalArgumentException(message);
        }
    }
}
